<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>餐桌</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					{if !$info['id']}<i class="fa fa-plus"></i> 添加餐桌{else}<i class="fa fa-pencil"></i> 编辑餐桌{/if}
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					<div class="layui-form" lay-filter="">
						<input type="hidden" name="info[id]" value="{$info.id}">
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">餐桌名称：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[name]" value="{$info.name}" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">分类：</label>
							<div class="layui-input-inline">
								<select name="info[cid]"  lay-verify="required">
									<option value="">--选择分类--</option>
									{foreach $tableCategory as $cate}
									<option value="{$cate['id']}" {if $cate['id']==$info['cid']}selected{/if}>{$cate.name}</option>
									{/foreach}
								</select>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">图片：</label>
							<input type="hidden" name="info[pic]" id="pic" lay-verType="tips" class="layui-input" value="{$info['pic']}">
							<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="pic" upload-preview="picPreview" onclick="uploader(this)">上传图片</button>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
							<div id="picPreview" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
								<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info['pic']}"/></div></div>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">座位数：</label>
							<div class="layui-input-inline">
								<input type="number" min="1" max="200" name="info[seat]" value="{$info.seat}" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">排序：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[sort]" value="{$info.sort|default=0}" class="layui-input">
							</div>
							<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">越大越靠前</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">预定：</label>
							<div class="">
								<input type="radio" name="info[canbook]" value="0" title="关闭" {if $info['canbook']==0}checked{/if}>
								<input type="radio" name="info[canbook]" value="1" title="开启" {if $info['canbook']==1}checked{/if}>
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">状态：</label>
							<div class="">
								<!--状态：-1禁用,0空，1预定，2入座-->
								<input type="radio" name="info[status]" value="0" title="空闲" {if $info['status']==0 || !$info['id']}checked{/if}>
								<input type="radio" name="info[status]" value="1" title="预定" {if $info['id'] && $info['status']==1}checked{/if}>
								<input type="radio" name="info[status]" value="2" title="入座" {if $info['id'] && $info['status']==2}checked{/if}>
								<input type="radio" name="info[status]" value="3" title="清台" {if $info['id'] && $info['status']==3}checked{/if}>
								<input type="radio" name="info[status]" value="-1" title="禁用" {if $info['id'] && $info['status']==-1}checked{/if}>
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label" style="width:100px">绑定打印机：</label>
							<div class="layui-input-inline" style="width:500px">
								{php} $storeids = explode(',',$info['print_ids']);{/php}
								{foreach $printArr as $k=>$v}
								<input type="checkbox" name="info[print_ids][]" value="{$k}" title="{$v}" lay-skin="primary" {if in_array($k,$storeids)}checked{/if}>
								{/foreach}
							</div>
							<div class="layui-form-mid layui-word-aux">普通场景在菜品中绑定打印区域即可，此处绑定打印机适合包间对应多个吧台出单的场景</div>
						</div>
						<div class="layui-form-item">
							<div class="layui-input-block" style="margin-left:130px;">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
					
				</div>
			</div>
		</div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
  </script>
	{include file="public/copyright"/}
</body>
</html>